feat: add global system tables framework under sys database#366
Open
suxiaogang223 wants to merge 13 commits into
Open
feat: add global system tables framework under sys database#366suxiaogang223 wants to merge 13 commits into
sys database#366suxiaogang223 wants to merge 13 commits into
Conversation
suxiaogang223
force-pushed
the
codex/global-system-tables
branch
from
July 2, 2026 08:45
e4597fa to
92de892
Compare
suxiaogang223
marked this pull request as ready for review
July 2, 2026 12:29
suxiaogang223
force-pushed
the
codex/global-system-tables
branch
from
July 2, 2026 13:00
55828f8 to
c5d3439
Compare
zjw1111
reviewed
Jul 9, 2026
zjw1111
left a comment
Collaborator
There was a problem hiding this comment.
Thanks a lot for building out the global sys system tables — the loader/registry split and reuse of InMemorySystemTable make the design clean and easy to follow.
I left a few inline comments. The most important one is a potential crash on the normal engine read path for sys.tables / sys.partitions / sys.all_table_options (see the comment in system_table.cpp). A couple of smaller notes are below:
global_system_tables.cpp(CatalogOptionsSystemTable::BuildRows, around line 264): this table stores fields via a non-owningstd::string_viewintocontext_.catalog_options, while the other tables copy throughBinaryString(StringValue). It's safe today because the map is a stable member, but for consistency and to avoid a future dangling-view footgun, would it be possible to useStringValue(...)here too?file_system_catalog.cpp(line 282): theconst_cast<FileSystemCatalog*>(this)looks unnecessary since only constCatalogmethods are used later — declaringGlobalSystemTableContext::catalogasconst Catalog*would let you drop it. Minor, feel free to skip.
Thanks again!
zjw1111
reviewed
Jul 9, 2026
zjw1111
left a comment
Collaborator
There was a problem hiding this comment.
One additional inline note on the sys.tables primary_key column — a schema/data-contract nit. Thanks!
lxy-9602
reviewed
Jul 9, 2026
suxiaogang223
force-pushed
the
codex/global-system-tables
branch
from
July 13, 2026 11:41
76f878a to
d79ca7b
Compare
- Add GetOptions() to Catalog interface for catalog-level config access - FileSystemCatalog stores and exposes catalog_options - New GlobalSystemTableLoader with independent registry for sys tables - Implement sys.catalog_options, sys.all_table_options, sys.tables - Stub for sys.partitions (manifest aggregation to follow) - Extend SystemTablePath with is_global flag - TryParsePath detects sys/ paths for TableScan/TableRead routing - FileSystemCatalog handles sys database in ListTables, DatabaseExists, TableExists, LoadTableSchema Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace the TODO stubs in TablesSystemTable::BuildRows() with actual manifest entry aggregation. The new AggregateFileStats() helper reads the latest snapshot data files and computes record_count, file_size, file_count, and last_file_creation_time. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace the stub with actual partition-level file statistics using the AggregateFileStats helper. For each partitioned table, read manifest entries and emit one row per partition with record_count, file_size, file_count, and last_update_time. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add 4 tests to SystemTableReadInteTest: - TestReadGlobalCatalogOptions: verifies sys.catalog_options schema and content - TestReadGlobalAllTableOptions: verifies sys.all_table_options with table options - TestReadGlobalTables: verifies sys.tables schema, table_type, partitioned, pk - TestReadGlobalPartitions: verifies sys.partitions returns empty for unpartitioned Tests use a ReadGlobalSystemTable helper that creates the GlobalSystemTableContext with a proper Catalog pointer. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
suxiaogang223
force-pushed
the
codex/global-system-tables
branch
from
July 17, 2026 02:28
bc70c46 to
fc812bb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add global system table support under the
sysdatabase, enabling catalog-level metadata queries.Closes part of #141.
Changes
Infrastructure
GetOptions()toCataloginterface for catalog-level config accessFileSystemCatalogstores and exposes catalog optionsGlobalSystemTableLoaderwith independent registry forsystablesSystemTablePathwithis_globalflag andTryParsePathto detectsys/pathsFileSystemCataloghandlessysdatabase inListTables/DatabaseExists/TableExists/LoadTableSchemaGlobal System Tables
sys.catalog_optionskey,valuesys.all_table_optionsdatabase_name,table_name,key,valuesys.tablesdatabase_name,table_name,table_type,partitioned,primary_key,record_count,file_size_in_bytes,file_count,last_file_creation_timesys.partitionsdatabase_name,table_name,partition_name,record_count,file_size_in_bytes,file_count,last_update_timeIntegration Tests (4 new tests in SystemTableReadInteTest)
TestReadGlobalCatalogOptions— verifies schema + contentTestReadGlobalAllTableOptions— verifies table options across databasesTestReadGlobalTables— verifies schema, table metadataTestReadGlobalPartitions— verifies empty result for unpartitioned tablesFiles Changed
Verification
Fedora x86_64, GCC 16:
🤖 Generated with Claude Code